import javax.swing.*;
import java.awt.*;

public class NotepadWithMenus extends JFrame {
    private JTextArea textArea;

    public NotepadWithMenus() {
        setTitle("简单记事本");
        setSize(800, 600);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);


        JMenuBar menuBar = new JMenuBar();


        JMenu fileMenu = new JMenu("文件");
        menuBar.add(fileMenu);

        JMenu formatMenu = new JMenu("格式");
        menuBar.add(formatMenu);


        JMenu viewMenu = new JMenu("查看");
        menuBar.add(viewMenu);


        JMenu helpMenu = new JMenu("帮助");
        menuBar.add(helpMenu);

        setJMenuBar(menuBar);


        textArea = new JTextArea();
        JScrollPane scrollPane = new JScrollPane(textArea);
        add(scrollPane, BorderLayout.CENTER);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            NotepadWithMenus notepad = new NotepadWithMenus();
            notepad.setVisible(true);
        });
    }
}    